﻿using System;
using DbTracker.Core.Schema.Model;

namespace DbTracker.MsSql.Model
{
    public class Role : MsSqlSchemaBase
    {
        public enum RoleTypeEnum
        {
            ApplicationRole = 1,
            DatabaseRole = 2
        }

        public Role(ISchema parent)
            : base(parent, ObjectType.Role)
        {
        }

        public override string FullName
        {
            get { return "[" + Name + "]"; }
        }

        public RoleTypeEnum Type { get; set; }

        public string Password { get; set; }

        public Boolean Compare(Role obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            if (Type != obj.Type) return false;
            return Password.Equals(obj.Password) && Owner.Equals(obj.Owner);
        }
    }
}